package com.zsh.mybatis.dao;

import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.plugin.*;

import java.sql.Statement;
import java.util.Properties;

/**
 * @author zsh
 * @Description
 * @create 2022-02-09 16:42
 */

@Intercepts({
        @Signature(type = StatementHandler.class,method = "parameterize",args = Statement.class)
})
public class MySecondPlugin implements Interceptor {
    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("MySecondPlugin-->intercept-->" + invocation.getMethod());

        return invocation.proceed();
    }

    public Object plugin(Object o) {
        System.out.println("MySecondPlugin-->plugin-->"+  o);
        Object wrap = Plugin.wrap(o, this);
        return wrap;
    }

    public void setProperties(Properties properties) {
        System.out.println("MySecondPlugin-->setProperties");
        System.out.println("插件配置信息：" + properties);

    }
}
